﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DP.RecallDeal.Interface.Requests;
using System.Configuration;

namespace DP.RecallDeal.Interface.Requests
{
    public sealed class ADPDeltaDateRequest : BaseRequest, IRequest
    {
        static string USERNAME = ConfigurationManager.AppSettings.Get("ADP_USERNAME");
        static string PASSWORD = ConfigurationManager.AppSettings.Get("ADP_PASSWORD");
        static string DEALERID = ConfigurationManager.AppSettings.Get("ADP_DEALERID");

        static string DELTA_DATE_REQUEST_URL = "http://staging.dmotorworks.com/pip-extract/salescurrent/test";
        static string QUERYID = "FISalesDelta";

        public string DeltaDate
        {
            set
            {
                base.Params.Add("deltaDate", value);
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="deltaDate">
        /// The date (MM/DD/YYYY) to pull all records changed after
        /// </param>
        public ADPDeltaDateRequest(string deltaDate)
            : base(DELTA_DATE_REQUEST_URL, new Dictionary<string, string>(), USERNAME, PASSWORD)
        {
            IDictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("queryId", QUERYID);
            parameters.Add("dealerId", "3PADEALERSPROCESSDEV1");
            parameters.Add("deltaDate", deltaDate);
            base.AddParams(parameters);
        }

        public ADPDeltaDateRequest()
            : base(DELTA_DATE_REQUEST_URL, new Dictionary<string, string>(), USERNAME, PASSWORD)
        {
            IDictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("queryId", QUERYID);
            parameters.Add("dealerId", "3PADEALERSPROCESSDEV1");
            base.AddParams(parameters);
        }
    }
}
